# sql注入
# 查询
# import pymysql
# conn = pymysql.Connection(host='127.0.0.1', user='root', password="123",
#                  database='day40')
# cur = conn.cursor()  # 游标 数据库操作符
# sql = 'select emp_name,salary from employee where age = %s'
# cur.execute(sql,(80,))
# # 获取结果
# ret1 = cur.fetchone()
# ret2 = cur.fetchmany(2)
# ret3 = cur.fetchall()
# print(ret1)
# print(ret2)
# print(ret3)
# cur.close()
# conn.close()

# insert语句 写入
# import pymysql
# conn = pymysql.Connection(host='127.0.0.1', user='root', password="123",
#                  database='day40')
# cur = conn.cursor()  # 游标 数据库操作符
# username = '太亮'
# sql = 'insert into employee(id,emp_name,sex,age,hire_date) values(%s,%s,"female",88,20170707)'
# cur.execute(sql,(21,username,))
# conn.commit()
# cur.close()
# conn.close()


# 文件操作数据库
# conn = pymysql.Connection(host='127.0.0.1', user='root', password="123",
#                database='day40')
# cur = conn.cursor()  # 游标 数据库操作符
# cur.excute(sql,(值1,))
    # 查询
        # fetchone fethmany(10) fetchaLL
    # 插入\更新\删除
        # conn.commit()
# cur.close()
# conn.close()
